package org.example.springioc;

import org.example.springioc.Component.UserComponent;
import org.example.springioc.Config.BeanConfig;
import org.example.springioc.Config.UserConfig;
import org.example.springioc.Controller.HelloController;
import org.example.springioc.Controller.UUserController;
import org.example.springioc.Controller.UserController;
import org.example.springioc.Service.UserService;
import org.example.springioc.model.UserInfo;
import org.example.springioc.repo.UserRepo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.interceptor.AbstractFallbackCacheOperationSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;


@SpringBootApplication
public class SpringIocApplication {
    public static void main(String[] args) {
      ApplicationContext context = SpringApplication.run(SpringIocApplication.class,args);
      /*  HelloController bean = context.getBean(HelloController.class);
        System.out.println(bean);
        bean.sayHi();


        HelloController helloController = (HelloController) context.getBean("helloController");
        System.out.println(helloController);
        helloController.sayHi();

        HelloController helloController1 = context.getBean("helloController",HelloController.class
        );
        System.out.println(helloController1);
        helloController1.sayHi();*/


       /* UserComponent bean = context.getBean(UserComponent.class);
        bean.doComponent();

        UserService service = context.getBean(UserService.class);
        service.doService();


        UserConfig bean2 = context.getBean(UserConfig.class);
        bean2.doConfig();

        UserRepo bean3 = context.getBean(UserRepo.class);
        bean3.doUserRepo();
*/

      /*UserInfo bean = context.getBean(UserInfo.class);
      System.out.println(bean);*/

       /* HelloController bean = context.getBean(HelloController.class);
        System.out.println(bean);
        bean.sayHi();*/

       UserController usercon = (UserController) context.getBean("Usercon");
       usercon.sayHi();

    }


}
